#include "SkyboxTechnique.h"


SkyboxTechnique::SkyboxTechnique(void)
{
}

bool SkyboxTechnique::Init()
{
	if(!Technique::Init())
	{
		std::cout << "Technique failed" << std::endl;
		if (std::cin.get() == '\n')		
			return false;
	}

	if(!AddShader(GL_VERTEX_SHADER, "Shader/test/test.vertexshader"))
	{
		std::cout << "AddShader(vertex) failed" << std::endl;
		if (std::cin.get() == '\n')		
			return false;
	}



	if(!AddShader(GL_FRAGMENT_SHADER, "Shader/test/test.fragmentshader"))
	{
		std::cout << "AddShader(frag) failed" << std::endl;
		if (std::cin.get() == '\n')		
			return false;
	}

	if(!Finalize())
	{
		std::cout << "Finalize failed" << std::endl;
		if (std::cin.get() == '\n')		
			return false;
	}

	m_WVPLocation = GetUniformLocation("gWVP");
	m_textureLocation = GetUniformLocation("gCubemapTexture");

    return true;
}

void SkyboxTechnique::SetWVP(const glm::mat4& WVP)
{
	glUniformMatrix4fv(m_WVPLocation, 1, GL_FALSE, &WVP[0][0]);
}


void SkyboxTechnique::SetTextureUnit(unsigned int TextureUnit)
{
	glUniform1i(m_textureLocation, TextureUnit);
}

